package cc.laop.service;

import cc.laop.dao.UserDao;
import cc.laop.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UserService {


    @Autowired
    private UserDao userDao;


    public List<User> select(User user) {
        List list = userDao.select(user);
        return list;
    }


    //@Transactional(propagation = Propagation.REQUIRES_NEW)
    @Transactional(propagation = Propagation.REQUIRED)
    public int insert(User user) {
        int result = userDao.insert(user);
        throw new RuntimeException("");
        //return result;
    }

}
